<template>
  <div>
    <h2>---子组件B---</h2>
    <ul>
      <li v-for="(item,index) in arr"
          :key="index">
        {{item.title}}:{{item.price}}</li>
    </ul>
    <hr>
  </div>
</template>

<script>
import bus from '../eventBus/index.js'

export default {
  props: ['arr'],
  data () {
    return {

    }
  },
  created () {
    bus.$on('subFn', (index, num) => {
      this.arr[index].price -= num
    })
  }
}
</script>

<style scoped>
</style>